#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
using namespace std;
#include<stdio.h>
int main()
{
	int n, num, max, min,sum = 0;
	cin >> n;
	cin >> num;
	max = num;
	min = num;
	sum += num;
	for (int i = 1; i < n; i++)
	{
		cin >> num;
		sum += num;
		if (max<num)
			max = num;
		if (min>num)
			min = num;
	}
	double ans = 1.0 * (sum - max - min) / (n - 2);
	printf("%.2f", ans);
	return 0;
}